package com.mygame.center.service;
import com.mygame.common.natsConfig.Subscribe;
import io.nats.streaming.Message;
import org.springframework.stereotype.Service;

import java.nio.charset.StandardCharsets;

@Service
public class NatsService {
    @Subscribe(value = "foo", durableName = "asdcdf")
    public void asd(Message message) {
        String s = new String(message.getData(), StandardCharsets.UTF_8);
        System.out.println("收到消息: " + s);
    }
}
